from pydantic import BaseModel
from typing import Literal

class UserFile(BaseModel):
  userid: str
  fileid: str
  
class TargetData(BaseModel):
  text: str
  lang: Literal["zh", "en"] = "zh"
  cutter: Literal["sentence4", "char50", "zh_period", "en_period", "punctuation", "line"] = "sentence4"
  
class ReferenceData(BaseModel):
  lang: Literal["zh", "en"] = "zh"
  fileid: str = None
  path: str = None
  emo: Literal["neutral", "angry", "sad"] = "neutral"
  voice: UserFile = None

class StreamAttachReq(BaseModel):
  client_id: str = None
  user_id: str
  
class StreamTextToSpeechReq(BaseModel):
  client_id: str
  target: TargetData
  reference: ReferenceData = None

class StreamDetachReq(BaseModel):
  client_id: str

class TextToSpeechReq(BaseModel):
  userid: str
  target: TargetData
  reference: ReferenceData = None
  
class AsrReq(BaseModel):
  fileid: str
  userid: str
  slice: bool = True
  enter: bool = True
  
class FinetuneReq(BaseModel):
  userid: str
  fileid: str = None